from pymilvus import MilvusClient
import typing as T
from fastapi import Depends
import logging
from . import ROOT_DIR

_client_embedding: MilvusClient = MilvusClient(
    uri=(ROOT_DIR / "data" / "mivlsus.db").as_posix()
)


def get_embedding_client():
    try:
        yield _client_embedding
    finally:
        ...


EmbeddingSession = T.Annotated[
    MilvusClient, Depends(get_embedding_client)
]  # 向量数据库

logging.info("向量数据库初始化完成...")
